<?php
	$JO["Cart"] 	 = JO(array("EN"=>"Cart",			"VI"=>"Giỏ Hàng"			));
	$JO["Order"] 	 = JO(array("EN"=>"Order",			"VI"=>"Đặt Mua"				));
	$JO["MyCart"] 	 = JO(array("EN"=>"My Cart",		"VI"=>"Giỏ Hàng Của Tôi"	));
	$JO["IWantTo"] 	 = JO(array("EN"=>"I want to...",	"VI"=>"Tôi muốn..."			));
	$JO["delete"] 	 = JO(array("EN"=>"Delete" ,		"VI"=>"Xóa"	 		  		));
	$JO["Update"] 	 = JO(array("EN"=>"Update" ,		"VI"=>"Cập Nhật"		  	));
	$JO["Sum"] 		 = JO(array("EN"=>"Sum - VND",		"VI"=>"Tổng Tiền - VNĐ"		));
	$JO["Name"] 	 = JO(array("EN"=>"Name",			"VI"=>"Họ và Tên"			));
	$JO["Phone"] 	 = JO(array("EN"=>"Phone",			"VI"=>"Số Điện Thoại"		));
	$JO["Address"] 	 = JO(array("EN"=>"Address",		"VI"=>"Địa Chỉ"				));
	$JO["BankTrans"] = JO(array("EN"=>"Bank Transfer",	"VI"=>"Chuyển Khoản"		));
	$JO["Payment"] 	 = JO(array("EN"=>"Payment *",		"VI"=>"Thanh Toán"			));
	
	$JO["Delivery"]  = JO(array("EN"=>"Delivery Payment + Commission",
								"VI"=>"Phí Vận Chuyển + Phí Thanh Toán"));
	
	$JO["OrderAll"]  = JO(array("EN"=>"Order Everything In My Cart",
								"VI"=>"Đặt Mua Tất Cả Trong Giỏ Hàng"));
	
	$JO["DeleteAll"] = JO(array("EN"=>"Delete Everything In My Cart",
								"VI"=>"Xóa Tất Cả Trong Giỏ Hàng"));
?>
<?

	/*

		상품 코드 있으면 한 상품만 구매

		없으면 카트 구매

	*/

	$query = "

		SELECT		*
		FROM		`cart`, `product`
		WHERE		`cart`.`delete` IS NULL
		AND			`cart`.`account` = '" . $_SESSION[ "JO_account_key" ] . "'
		AND			`cart`.`product` = `product`.`key`

	";

	$recordSet = JO_query( $query );

?>



<div class="JO_unit">

	<h1><?= $JO["Cart"] ?></h1>

	<div><img src="JO_80_image/JO_00_blank.gif" /></div>

</div>



<div class="JO_relative" style="width: 960px;">



	<div class="JO_left">

		<div class="JO_box_240">

			<h1><?= $JO["IWantTo"] ?></h1>

			<a href="#this" class="JO_menu" onclick="alert( '' );"><?= $JO["OrderAll"] ?></a>
			
			<a href="#this" class="JO_menu" onclick="if( confirm( '' ) ) alert( '' );"><?= $JO["DeleteAll"] ?></a>

		</div>

	</div>



	<div class="JO_left">



		<div class="JO_bar_720">

			<h1><?= $JO["MyCart"] ?></h1>

			<div>

				<? if( $recordSet -> num_rows ) while( $record = $recordSet -> fetch_array( ) ) { ?>

					<img src="" /> &nbsp;
					<?= $record[ "subject" ] ?> &nbsp;
					<?= $record[ "price" ] ?> *	<input type="text" value="<?= $record[ "amount" ] ?>" /> &nbsp;
					<a href="#this"><?= $JO["delete"] ?></a> &nbsp;
					<a href="#this"><?= $JO["Update"] ?></a> 자동 업데이트 후 전체 가격 합산<br />

				<? } ?>

				<?= $JO["Sum"] ?>

			</div>

		</div>



		<div class="JO_bar_720">

			<h1><?= $JO["Order"] ?></h1>

			<div>

				<input type="text" value="<?= $_SESSION[ "JO_account_name"		] ?>" > <?= $JO["Name"] 	?> *<br/>
				<input type="text" value="<?= $_SESSION[ "JO_account_phone"		] ?>" > <?= $JO["Phone"]	?> *<br/>
				<input type="text" value="<?= $_SESSION[ "JO_account_address"	] ?>" > <?= $JO["Address"] 	?> *<br/>
				<input type="text" value="<?= $_SESSION[ "JO_account_mail"		] ?>" > E-Mail<br/>

				<select>
					<option></option>
					<option> <?= $JO["BankTrans"] 	?>	</option>
					<option> <?= $JO["Delivery"]	?>	</option>
					<option> JukeOn™ Point				</option>
				</select> <?= $JO["Payment"] ?> *<br/>

				<input
					type	= "submit"
					value	= "<?= $JO["Order"] ?>"
					class	= "JO_button"
					style	= "width: 702px;"
					onclick	= "alert( '' );"
				/>

			</div>

		</div>



	</div>

</div>
